# Recipe file for riscv-qemu.
#
# Maintainers: (C) 2016 Mateus P. Rodrigues, mprodrigues@dragora.org.
#
# Under the terms of the GNU General Public License.

program=riscv-qemu
version=20160920
release=1

description="
This is a qemu fork with RISC-V support, both RV64G and TV32G are supported.
Upstream qemu version is 2.7.50
"

homepage=https://github.com/riscv/riscv-qemu
license=GPLv2

tarname=${program}-${version}.tar.lz

# Remote source(s)
fetch=""

# Parallel jobs for the compiler
jobs=1

# Source documentation
docs="Changelog CODING_STYLE COPYING* HACKING LICENSE MAINTAINERS README* VERSION"

build() {
    unpack "${tardir}/$tarname"

    cd "$srcdir"
    ./configure

    make -j${jobs}
    make -j${jobs} install DESTDIR="$destdir"

    # Compress manual pages
    lzip -9 "${destdir}/usr/local/share/man/man1/qemu.1"
    lzip -9 "${destdir}/usr/local/share/man/man1/qemu-img.1"
    lzip -9 "${destdir}/usr/local/share/man/man1/virtfs-proxy-helper.1"
    lzip -9 "${destdir}/usr/local/share/man/man8/qemu-ga.8"
    lzip -9 "${destdir}/usr/local/share/man/man8/qemu-nbd.8"

    # Copy documentation
    mkdir -p "${destdir}/usr/local/share/doc/${program}-${version}"
    cp -p $docs "${destdir}/usr/local/share/doc/${program}-${version}/"
}
